package com.itheima.mapper;

import com.itheima.pojo.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface OrderMapper {

    /**
     * 获取预约情况
     * @return
     */
    @Select("select " +
            "    setmeal_id as  setmealId," +
            "    count(setmeal_id) as count " +
            "from t_order " +
            "group by setmeal_id")
    List<Order> getOrderList();

    /**
     * 获取相应日期区间内的到诊数
     * @param begin
     * @param end
     * @return
     */
    @Select("select count(*) from t_order where orderDate in(#{begin} , #{end}) and orderStatus = '已到诊'")
    Integer getVisitsCount(LocalDate begin, LocalDate end);
}
